
<template>
	<view>
		<!-- 投资预算调整审核 -->
		<view class="head_tb">
			<u-tabs :activeStyle="{
						 fontSize:'32rpx',
						 color: '#007aff'
			         }" :inactiveStyle="{
						 fontSize:'30rpx'
			         }" :scrollable='false' :lineWidth='30' itemStyle='height:90rpx;width:33%' :list="list1"
				@click="checkbtn"></u-tabs>
		</view>
			
		<!-- 基本信息 -->
		<view class="msp">
			<CellChild :addlist='addlist' :rows='rows' title='基本信息' isshow='true' :fileNo = 'fileNo' id='add_one'>
			</CellChild>
		</view>
		<!-- 调出预算明细 -->
		<view class="formcard" id="add_two" v-if="addshow">
			<view class="bodtitle">
				<p><b>调出预算明细</b></p>
			</view>
			<view v-for="(item,index) in outSubInfos">
				<Expandlist :cellshows='cellshow' :arrcell='item' :celllist='celllist' :title='item.subProName'>
					<template #text>
						<p class='solts'><label class="solts_label"><label style='font-size: 18rpx;color: #999999;'>调出</label>￥</label><span class="solts_span" v-money>{{item.budgetAmount}}</span></p>
					</template>
				</Expandlist>
			</view>
		</view>
		
		<!-- 调入预算明细 -->
		<view class="formcard" id="add_three" v-if="addshow">
			<view class="bodtitle">
				<p><b>调入预算明细</b></p>
			</view>
			<view v-for="(r,index) in inSubInfos">
				<Expandlist :cellshows='cellshow' :arrcell='r' :celllist='celllist1' :title='r.subProName'>
					<template #text>
						<p class='solts'><label class="solts_label"><label style='font-size: 18rpx;color: #999999;'>调入</label>￥</label><span class="solts_span" v-money>{{r.budgetAmount}}</span></p>
					</template>
				</Expandlist>
			</view>
		</view>
		
		
		
		<!-- 项目削减 -->
		<view class="formcard" id="add_two" v-if="delshow">
			<view class="bodtitle">
				<p><b>项目信息</b></p>
			</view>
			<view v-for="(item,index) in proInfos">
				<Expandlist :cellshows='cellshow' :arrcell='item' :celllist='contlist' :title='item.budgetNo'>
					<template #text>
						<p class='solts'><label class="solts_label">￥</label><span class="solts_span" v-money>{{item.budgetAmount}}</span></p>
					</template>
				</Expandlist>
			</view>
		</view>
		
		<!-- 子项目信息 -->
		<view class="formcard" id="add_two" v-if="delshow">
			<view class="bodtitle">
				<p><b>子项目信息</b></p>
			</view>
			<view v-for="(item,index) in subInfos">
				<Expandlist :cellshows='cellshow' :arrcell='item' :celllist='contchiledlist' :title='item.subProName'>
					<template #text>
						<p class='solts'><label class="solts_label">￥</label><span class="solts_span" v-money>{{item.budgetAmount}}</span></p>
					</template>
					<template #list>
						<view class="bod_cost"
							style="background-color: #f7fbff;border: 1px solid white;">
							<view class="bus">
								<p style='color: #666666'>付款计划金额</p>
							</view>
							<view>
								<p v-for="(r,index) in item.subInfoPayEntityList" class='bodcolors' style='word-break:break-all ;' v-money>{{r.payAmount}}</p>
							</view>
						</view>
						<view class="bod_cost"
							style="background-color: #f7fbff;border: 1px solid white;">
							<view class="bus">
								<p style='color: #666666'>付款削减金额</p>
							</view>
							<view>
								<p v-for="(r,index) in item.subInfoPayEntityList" class='bodcolors' style='word-break:break-all ;'  v-money>{{r.payCutAmount}}</p>
							</view>
						</view>
					</template>
				</Expandlist>
			</view>
		</view>
		
		
		
		<!-- 项目取消 项目中止 -->
		<view class="formcard" id="add_three" v-if="qxshow">
			<view class="bodtitle">
				<p><b>{{title}}</b></p>
			</view>
			<view v-for="(r,index) in proInfos">
				<Expandlist :cellshows='cellshow' :arrcell='r' :celllist='qxlist' :title='r.proName'>
					<template #text>
						<p class='solts'><label class="solts_label"><label style='font-size: 18rpx;color: #999999;'>预算</label>￥</label><span class="solts_span" v-money>{{r.reviewAmount}}</span></p>
					</template>
				</Expandlist>
			</view>
		</view>
		
		<view class="formcard" id="add_three" v-if="qxshow">
			<view class="bodtitle">
				<p><b>子项目明细</b></p>
			</view>
			<view v-for="(r,index) in subInfos">
				<Expandlist :cellshows='cellshow' :arrcell='r' :celllist='qxchiledlist' :title='r.subProName'>
					<template #text>
						<p class='solts'><label class="solts_label"><label style='font-size: 18rpx;color: #999999;'>调入</label>￥</label><span class="solts_span" v-money>{{r.budgetAmount}}</span></p>
					</template>
					<template #list>
						<view class="bod_cost"
							style="background-color: #f7fbff;border: 1px solid white;">
							<view class="bus">
								<p style='color: #666666'>付款计划金额</p>
							</view>
							<view>
								<p v-for="(s,index) in r.subInfoPayEntityList" class='bodcolors' style='word-break:break-all ;' v-money>{{s.payAmount}}</p>
							</view>
						</view>
					</template>
				</Expandlist>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list1: [{
						name: '基本信息',
					},
					{
						name: '项目信息'
					},
					{
						name: '子项目明细'
					},
				],
				list2: [{
						name: '基本信息',
					},
					{
						name: '调出明细'
					},
					{
						name: '调入明细'
					},
				],
				cellshow:true,
				addlist: [{
						tit: '单据编号',
						val: 'billNo'
					},
					{
						tit: '单据日期',
						val: 'billDate'
					},
					{
						tit: '调整类型',
						val: 'adjustType'
					},
					{
						tit: '调整说明',
						val: 'adjustDesc'
					},
					{
						tit: '科室',
						val: 'subdeptNm'
					},
					{
						tit: '工号',
						val: 'userId'
					},
					{
						tit: '项目担当',
						val: 'empName'
					},
					{
						tit: '联系电话',
						val: 'phone'
					},
				],
				celllist:[
					{tit:'预算编号',val:'sonBudgetNo'},
					{tit:'投资大类',val:'investGeneralCategory'},
					{tit:'投资小类',val:'investSubCategory'},
					{tit:'预算金额',val:'budgetAmount',type:'number'},
					{tit:'调出金额',val:'outAmount',type:'number'},
				],
				celllist1:[
					{tit:'预算编号',val:'sonBudgetNo'},
					{tit:'投资大类',val:'investGeneralCategory'},
					{tit:'投资小类',val:'investSubCategory'},
					{tit:'预算金额',val:'budgetAmount',type:'number'},
					{tit:'调入金额',val:'inAmount',type:'number'},
				],
				//项目削减信息
				contlist:[
					// {tit:'预算编号',val:'budgetNo'},
					{tit:'投资大类',val:'catNm'},
					{tit:'投资小类',val:'subCatNm'},
					{tit:'预算金额',val:'reviewAmount',type:'number'},
					{tit:'削减金额',val:'cutAmount',type:'number'}	
				],
				//项目取消 中止信息
				qxlist:[
					{tit:'预算编号',val:'budgetNo'},
					{tit:'投资大类',val:'catNm'},
					{tit:'投资小类',val:'subCatNm'},
					{tit:'预算金额',val:'reviewAmount',type:'number'},
				],
				contchiledlist:[
					{tit:'子项目预算编号',val:'sonBudgetNo'},
					{tit:'预算金额',val:'reviewAmount',type:'number'},
					{tit:'提单计划金额',val:'billAmount',type:'number'},
					{tit:'提单削减金额',val:'billCutAmount',type:'number'},
					{tit:'合同计划金额',val:'contractAmount',type:'number'},
					{tit:'合同削减金额',val:'contractCutAmount',type:'number'}	,
				],
				qxchiledlist:[
					{tit:'子项目预算编号',val:'sonBudgetNo'},
					{tit:'预算金额',val:'reviewAmount',type:'number'},
					{tit:'提单计划金额',val:'billAmount',type:'number'},
					{tit:'合同计划金额',val:'contractAmount',type:'number'},
					// {tit:'付款计划金额',val:'',type:'number'},
				],
				title:'项目取消信息',
				rows:[],
				arrlist:[],
				proInfos:[], //项目信息
				outSubInfos:[], //调出
				inSubInfos:[], //调入
				addshow:false, //项目调剂
				delshow:false, //项目消减
				qxshow:false, //项目取消
				fileNo:[]
			}
		},
		onLoad() {
			//获取流程页面的流程上下文[实用的流程信息从这里获取]
			 let billNo= window.parent.myvm.wfContext.BusinessKey;
			 this.fileNo =  window.parent.myvm.wfContext.BusinessKey;
			 this.getlist(billNo)
		},
		created() {
		},
		mounted() {
			var that = this;
			window.myvm = that;
			window.$urlFormVue = that;
		},
		methods: {
			getlist(billNo){
				let _this = this
				let params = {
					billNo
				}
				_this.$lyRequest.get('/gateway/budget/mp/dbsap/invest/budgetAdjust/getInvestAdjustDetail.do',
					params
				).then((result) => {
					if (result.success) {
						console.log(result)
						this.rows = result.data.rows
						this.outSubInfos = result.data.rows.outSubInfos
						this.inSubInfos = result.data.rows.inSubInfos
						this.subInfos = result.data.rows.subInfos
						this.proInfos = result.data.rows.proInfos
						this.fileNameList = result.data.rows.fileNameList
						this.changeadjust()
						
					} else {
						console.log(result.data.msg)
					}
				})
			},
			changeadjust(){
				if(this.rows.adjustType == 1){
					this.rows.adjustType = '项目调剂'
					this.list1 = this.list2
					this.addshow = true
					this.outSubInfos.forEach((item)=>{
						this.$set(item,'investGeneralCategory',this.rows.investGeneralCategory)
						this.$set(item,'investSubCategory',this.rows.investSubCategory)
					})
					this.inSubInfos.forEach((item)=>{
						this.$set(item,'investGeneralCategory',this.rows.investGeneralCategory)
						this.$set(item,'investSubCategory',this.rows.investSubCategory)
					})
					return false
				}else if(this.rows.adjustType == 2){
					this.rows.adjustType = '项目削减'
					this.title = '项目削减信息'
					this.delshow = true
					return false
				}else if(this.rows.adjustType == 3){
					this.rows.adjustType = '项目取消'
					this.qxshow = true
					return false
				}else if(this.rows.adjustType == 4){
					this.rows.adjustType = '项目中止'
					this.title = '项目中止信息'
					this.qxshow = true
					return false
				}
			},
			//审批和驳回-工作流点击"提交"时触发此函数，返回:空字符串:工作流继续提交，返回"具体错误信息":工作流不提交
			rejectWorkflow(btnDef) {
				return "";
			},
			//作废-工作流点击"作废"时触发此函数，返回:空字符串:工作流继续提交，返回"具体错误信息":工作流不提交
			//content为作废意见
			invalidWorkflow(content) {
				return "";
			},
			//转办-工作流点击"确认转办"时触发此函数，返回:空字符串:工作流继续提交，返回"具体错误信息":工作流不提交
			//opinion:转办意见
			referredWorkflow(opinion) {
				return "";
			},
			//校验-工作流点击"提交"时触校验函数，返回:true校验通过，false校验不通过；
			//也可以返回具体的错误信息：空字符串，校验通过，返回具体错误信息校验不通过，同时弹出具体的错误信息。
			validateWorkflowForm(btnDef,callback) {
				callback("");
			},
			//提交单据
			sendWorkflow(btnDef, callback) {
				callback("");
			},
			checkbtn(item) { //切换tabs
				if (item.index === 0) {
					this.commonApi.goAnchor('add_one')
				} else if (item.index === 1) {
					this.commonApi.goAnchor('add_two')
				} else if (item.index === 2) {
					this.commonApi.goAnchor('add_three')
				}
			},
			
		}
	}
</script>

<style scoped lang="scss">
view{
	font-family: pf;
}

.bodcolor{
		span{
			color:#ff6400;
			font-size: 36rpx;
			padding-right: 20rpx;
		}
		label{
			color: #ff6400;
		}
	}
	.bottom_setup {
		width: 100%;
		height: 160rpx;
		background-color: white;
		margin-top: 20rpx;
		padding: 35rpx 0;
		box-sizing: border-box;
		box-shadow: 5px -10rpx 5px 0px rgba(225, 225, 225, .4), ;
	
		.bottom_white1 {
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: space-between;
			height: 100rpx;
	
			.custom-styles {
				padding: 20rpx 30rpx;
				width: 300rpx;
				height: 100rpx;
			}
	
			.custom-style {
				padding: 20rpx 30rpx;
				width: 300rpx;
				height: 100rpx;
				background-color: #007aff;
			}
		}
	}
</style>
